package com.buddy.learn.javasource._collection;

import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue;

/**
 * @author Buddy
 * @date 2021/5/8
 */
public class _Queue {
    public static void main(String[] args) throws InterruptedException {
        LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue();
        try {
            linkedBlockingQueue.put("1");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        try {
            linkedBlockingQueue.take();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        SynchronousQueue synchronousQueue = new SynchronousQueue();
        try {
            synchronousQueue.put(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        DelayQueue delayQueue = new DelayQueue();
        delayQueue.put(null);
        delayQueue.take();

        ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(14,true,new ArrayList());
        arrayBlockingQueue.put(1);
        arrayBlockingQueue.take();
    }
}
